package protocol;

import java.io.IOException;

import com.google.gson.Gson;
import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseStream;
import com.lidroid.xutils.http.client.HttpRequest.HttpMethod;

import conf.constants.URLS;
import base.BaseProtocol;
import bean.HomeBean;

/**
 * 负责HomeFragment的网络请求
 * @author Anson-pc
 *
 */
public class HomeProtocol extends BaseProtocol<HomeBean>{

/*	@Override
	protected HomeBean parseJsonString(String jsonString) {
		Gson gson = new Gson();
		HomeBean homeBean = gson.fromJson(jsonString, HomeBean.class);
		return homeBean;
	}*/

	@Override
	protected String getInterceKey() {
		// TODO Auto-generated method stub
		return "home";
	}
/*	public HomeBean loadData(int index) throws Exception{
		HttpUtils httpUtils = new HttpUtils();
		String  url = URLS.BaseUrl +"home";
		
		//请求的参数
		RequestParams params = new RequestParams();
		params.addQueryStringParameter("index", "0");
		ResponseStream responseStream = httpUtils.sendSync(HttpMethod.GET, url, params);
		
		String jsonString = responseStream.readString();
System.out.println("HomeFragment: "+jsonString);
		//解析json数据
		Gson gson = new Gson();
		HomeBean homeBean = gson.fromJson(jsonString, HomeBean.class);
		return homeBean;
	}*/
}
